#include "MatchMenu.h"
#include "ServiceProvider.h"
#include "StringUtilities.h"
#include "PrintUtilities.h"
#include "MenuManager.h"
#include "GamePrintUtils.h"

MatchMenu::MatchMenu(MenuManager* const i_menuManager)
	: Menu(i_menuManager)
	,m_match(0)
{
}

void MatchMenu::Draw() const
{
	using namespace STD; using namespace Print;

	cout << Title("MATCH MENU'");

	if(m_match)
	{
		PrintMatchData(cout, *m_match, GetSP());
	}
	else
	{
		cout << "\n\nThe match has not yet been played!\n\n";
	}

	STL::string options;
	options += "\n1) Print Match Events.";
	options += "\n0) Return to previous menu'.";
	cout << Options(options);
}

bool MatchMenu::Input(const STL::string& i_input)
{
	bool goodInput = true;

	int res = Utilities::StringToInt(i_input);

	if (res == 0)
	{
		GetMM()->PopMenu();
	}
	else if(res == 1)
	{
		if(m_match)
		{
			PrintMatchEvents(STD::cout, *m_match);
			system("pause");
		}
	}
	else
	{
		goodInput = false;
	}
	
	return goodInput;
}
